﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using System.Web.Script.Serialization;

namespace VietnameseSlangBackend.WebServices
{
    public class Human
    {
        public string Name { get; set; }
        public int Age { get; set; }
    }

    /// <summary>
    /// Summary description for Dictionary
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    [ScriptService]
    public class Dictionary : System.Web.Services.WebService
    {

        [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string HelloWorld()
        {
            Human firstHuman = new Human()
            {
                Name = "Leon",
                Age = 25
            };
            // Return JSON data
           JavaScriptSerializer js = new JavaScriptSerializer();
           string strJSON = js.Serialize(firstHuman);
           return strJSON;
           return "Hello World";
        }
    }
}
